package com.yzcs.tvapp.simple.fragment

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.fy.baselibrary.application.mvvm.BaseViewModel
import com.fy.baselibrary.application.mvvm.IBaseMVVM
import com.fy.baselibrary.base.fragment.FragmentChangeManager
import com.yzcs.tvapp.R
import com.yzcs.tvapp.databinding.SimpleFragmentActivityLayoutBinding

/**
 * description fragment 容器 activity
 * Created by fangs on 2021/9/17 15:04.
 */
class SimpleFragmentActivity: AppCompatActivity(), IBaseMVVM<BaseViewModel, SimpleFragmentActivityLayoutBinding> {

    override fun setContentLayout(): Int {
        return R.layout.simple_fragment_activity_layout
    }

    override fun initData(
        viewModel: BaseViewModel?,
        dataBinding: SimpleFragmentActivityLayoutBinding?,
        savedInstanceState: Bundle?
    ) {

        val bundle = Bundle()
        bundle.putSerializable("videoBean", intent.extras!!.getSerializable("videoBean"))

        val fragment = SimpleFragment()
        fragment.arguments = bundle
        val fcm = FragmentChangeManager(supportFragmentManager, R.id.fmContent, fragment)
        fcm.setFragments(0)
    }

    override fun onBackPressed() {
        finish()
    }
}